<?php
/**
 * 订单状态回写---批量发货。
 * 
 * @author liugang<liugang@shopex.cn>
 * @version 1.0
 */
error_reporting(E_ALL ^ E_NOTICE);
set_time_limit(600);
require_once(dirname(__FILE__) . '/../../lib/init.php');

//$db = kernel::database();
$sql = "SELECT order_id FROM sdb_ome_orders WHERE  1  
			AND (sdb_ome_orders.op_id is not null OR sdb_ome_orders.group_id is not null ) 
			AND (sdb_ome_orders.is_cod='true' OR sdb_ome_orders.pay_status='1' OR sdb_ome_orders.pay_status='4' OR sdb_ome_orders.pay_status='5') and logi_no <> '' 
			AND 1 AND `sdb_ome_orders`.status in ('active','finish')  
			AND `sdb_ome_orders`.process_status in ('splited','confirmed','splitting','remain_cancel')  
			AND `sdb_ome_orders`.createway='matrix' AND `sdb_ome_orders`.sync IN ('fail','run','none')";

$row = kernel::database()->select($sql);

$ids = array();
foreach ($row as $k => $v) {
	$ids[$k] = $v['order_id'];
}

$deliveryObj = app::get('ome')->model('delivery');
if (!empty($ids)) {

    kernel::single('ome_event_trigger_shop_delivery')->delivery_confirm_retry($ids);
}

?>

